package com.bestdreamer.transdata;


public class Demo1ThreadA extends Thread {
    private final Object lock;

    public Demo1ThreadA(Object lock){
        super();
        this.lock = lock;
    }

    @Override
    public void run() {
        try{
            synchronized (lock){
                if(Demo1MyList.size() != 5){
                    System.out.println("wait begin " + System.currentTimeMillis());
                    lock.wait();
                    System.out.println("wait end " + System.currentTimeMillis());
                }
            }
        }catch (InterruptedException e){
            e.printStackTrace();
        }
    }
}
